python print list as string

27

list1 = [1, 2, 3]
str1 = ''.join(str(e) for e in list1)
list1 = ['1', '2', '3']
str1 = ''.join(list1)
>>> L = [1,2,3]       
>>> " ".join(str(x) for x in L)
'1 2 3'

Comments

Submit
0 Comments